/**
 * Created by mill on 2017/12/9.
 */
var mysql      = require('mysql');
var connection = mysql.createConnection({
  host     : 'localhost',
  user     : 'root',
  password : '',
  database : 'test'
});

connection.connect();

connection.query('select * from userInfo', function (error, rows, fields) {
  if (error) throw error;
  rows.forEach((item)=>{
    console.log('the user name is %s!',item.u_name);
  });
});

/*the user name is 张三!
the user name is 李四!
the user name is 王五!
the user name is 张三!
the user name is 李四!
the user name is 王五!
the user name is 张三!
the user name is 李四!
the user name is 王五!
the user name is 张三!*/

connection.end();